const express = require('express');
const router = express.Router();

router.get('/', (req, res) => {
    const content = [];
    const {pageIndex, pageSize} = req.query;
    for(let i = 0; i < 10; i++)
        content.push({
            id: `2019${i}`,
            code: 'string',
            title: 'string',
            dealerCode: 'string',
            brandCode: 'string',
            productCategoryCode: 'string',
            partCode: 'string',
            partName: 'string',
            lv1FaultItemCode: 'string',
            lv2FaultItemCode: 'string',
            lv3FaultItemCode: 'string',
            qLevel: 1,
            severity: 5,
            frequency: 30,
            marketImpact: 40,
            soc: 50,
            rowVersion: 'string',
            options: ['update', 'submit', 'close', 'release'],
        });
    res.json({
        message: '',
        payload: {
            content,
            pageIndex: parseInt(pageIndex, 10),
            pageSize: parseInt(pageSize, 10),
            totalElements: 50
        }
    });
});
router.put('/:id', (req, res) => {
    res.json({
        message: '立项'
    });
});
router.post('/forSocClaim', (req, res) => {
    res.json({
        message: '立项'
    });
});
router.put('/forSocClaim/join', (req, res) => {
    res.json({
        message: '加入项目'
    });
});
router.put('/:id/submit', (req, res) => {
    res.json({
        message: '提交'
    });
});
router.put('/:id/release', (req, res) => {
    res.json({
        message: '发布'
    });
});
router.put('/:id/close', (req, res) => {
    res.json({
        message: '关闭'
    });
});
router.get('/:id', (req, res) => {
    res.json({
        message: 'ok',
        payload: {
            id: '1',
            dealerId: 'string',
            dealerCode: 'string',
            brandId: 'string',
            brandCode: 'string',
            country: 'string',
            productCategoryId: 'string',
            productCategoryCode: 'string',
            partId: 'string',
            partCode: 'string',
            partName: 'string',
            lv1FaultItemCode: 'string',
            lv2FaultItemCode: 'string',
            lv3FaultItemCode: 'string',
            quantity: 10,
            serialNumber: 'string',
            lv1ProductCateCode: 'string',
            lv2ProductCateCode: 'string',
            lv3ProductCateCode: 'string',
            warrantys: 10,
            vehicles: 5,
            frequency: 10,
            rowVersion: 'string',
            options: ['update', 'submit', 'close', 'release'],
            details: [
                {
                    id: '1',
                    repairCode: 'string',
                    vin: 'string',
                    engineCode: 'string',
                    engineModelTransmissionModel: 'string',
                    saleDate: '2020-06-22T08:18:42.002Z',
                    mileage: 10,
                    faultType: 1,
                    faultDescription: 'string',
                    orderType: 1
                },
                {
                    id: '2',
                    repairCode: 'string',
                    vin: 'string',
                    engineCode: 'string',
                    engineModelTransmissionModel: 'string',
                    saleDate: '2020-06-22T08:18:42.002Z',
                    mileage: 10,
                    faultType: 1,
                    faultDescription: 'string',
                    orderType: 1
                },
                {
                    id: '3',
                    repairCode: 'string',
                    vin: 'string',
                    engineCode: 'string',
                    engineModelTransmissionModel: 'string',
                    saleDate: '2020-06-22T08:18:42.002Z',
                    mileage: 10,
                    faultType: 1,
                    faultDescription: 'string',
                    orderType: 1
                }
            ],
        }
    });
});
module.exports = router;
